/*
 * fft.h
 *
 *  Created on: 2009-7-23
 *      Author: wyb
 */

#ifndef FFT_H_
#define FFT_H_

#include <fftw3.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "util.h"

#define PERCENT_TYPE 1

struct fft_complex {
	int N;
	fftw_complex *data;
};

struct fft_cosine {
	int N;
	double (*A)[3]; //0:振幅,1:相位,2:频率
};

void output_complex(struct fft_complex *value, char *str);

void output_cos(struct fft_cosine *value, char *str);

void file_cos_A(struct fft_cosine *value, char *str);

void file_complex(struct fft_complex *value, char *str);

struct fft_complex *fft(struct fft_complex *value);

struct fft_complex *ifft(struct fft_complex *value);

struct fft_complex *ifft_cosine(struct fft_cosine *value, int n);

double compute_conine(struct fft_cosine *value, int N, double period, double x);

struct fft_cosine *complex_to_cosine(struct fft_complex *value);

struct fft_complex *real_to_complex(struct double_array *value);

struct double_array *complex_to_real(struct fft_complex *value);

#endif /* FFT_H_ */
